function omitBuilder(omitFieldMap) {
	return (key, value) => (key in omitFieldMap ? undefined : value);
}

export default function omitNested(data, field) {
	const omitFieldMap = [].concat(field).reduce((obj, x) => {
		obj[x] = true;
		return obj;
	}, {});
	return JSON.parse(JSON.stringify(data), omitBuilder(omitFieldMap));
}
